/**生成随机的数据，数字、字母、符号、汉字、摩斯码、颜色码、激活码、计算题、拼音、种子随机数、名字
 * author:ywx620
 * web:https://ywx620.gitee.io/learn/
*/
const p1 = function (exports) {
	function color(type='#'){
		let c=parseInt(Math.random()*0XFFFFFF)
		switch(type){
			case '#':
				c=c.toString(16);
				while (c.length < 6){c = '0' + c;}
				return "#"+c;
			case 'rbg':
				return [c>>16,c>>8&0xff,c&0xff];
			case '{rbg}':
				return JSON.parse('{"r":'+(c>>16)+',"b":'+(c>>8&0xff)+',"g":'+(c&0xff)+'}');
			case '(rbg)':
				return 'rgb('+(c>>16)+','+(c>>8&0xff)+','+(c&0xff)+')';
		}
		return c;
	}
	function number(num=1){
		let mix=Math.pow(10,num)-1;
		let min=Math.pow(10,num-1);
		return Math.floor(Math.random()*(mix-min+1)+min);
	}
	var randomSeed=3453562;
	function numberBySeed(){
		p1.randomSeed = (p1.randomSeed * 16807 + 0) % 2147483647;
		return p1.randomSeed / 2147483647.0;
	}
	function letter(type=1){
		let [start,end] = [65,90];//大写字母
		if(type==2){
			[start,end] = [97,122];//小写字母
		}
      	const randomUnicode = Math.floor(Math.random() * (end - start + 1)) + start;
		return String.fromCharCode(randomUnicode);
	}
	function key(num=10){
		let k='';
		for(let i=0;i<num;i++){
			k+=Math.random()>0.5?letter(1):letter(2);
		}
		return k;
	}
	function calc(num1=3,num2=2,type=0){
		let [a,b]=[number(num1),number(num2)];
		if(a<b){let temp=a; a=b; b=temp;}
		let val;
		switch(type){
			case 0:val=a+'+'+b+'=';break;
			case 1:val=a+'-'+b+'=';break;
			case 2:val=a+'×'+b+'=';break;
			case 3:val=a+'÷'+b+'=';break;
		}
		return val;
	}
	function calcResult(title,type=0){
		let signs=['+','-','×','÷'];
		let ts=title.split('=')[0];
		let [s,v]=['',0];
		signs.find(a=>{
			if(ts.includes(a)){
				ts=ts.split(a);s=a;
				return true;
			}
		})
		let [a,b]=[Number(ts[0]),Number(ts[1])]
		if(s=='÷'){
			let x=a%b;
			let y=(a-x)/b;
			v=y+(x!=0?'...'+x:'');
		}else{
			s=s=='×'?'*':s;
			v=eval(ts[0]+s+ts[1]);
		}
		if(type==0){
			return title+v;
		}else{
			return v;
		}
	}
	function hanzi(){
		let [start,end] = [0x4e00,0x9fff];//Unicode
      	const randomUnicode = Math.floor(Math.random() * (end - start + 1)) + start;
		return String.fromCharCode(randomUnicode);
	}
	function sign(){
		let as = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '_', '=', '+', '[', ']', '{', '}', ';', ':', ',', '.', '?'];
		return as[Math.floor(Math.random() * as.length)];
	}
	function morse(){
		let as=['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..-','...-','.--','-..-','-.--','--..','.----','..---','...--','....-','.....','-....','--...','---..','----.','-----']
		return as[Math.floor(Math.random() * as.length)];
	}
	/**
	 * 生成拼音,type为0和负数随机，1-4为固定声调，大于等于5不标注声调
	 */
	function pinyin(type=-1){
		let pys=P1_PY;
		let p0=pys[0];
		let num=Math.floor(Math.random()*p0.length);
		let ps=[];
		for(let i=1;i<pys.length;i++){
			let pp=pys[i];
			for(let j=0;j<pp.length;j++){
				if(j==num){
					if(pp[j]){
						ps.push(pp[j]);
						break;
					}
				}
			}
		}
		let py=ps[Math.floor(Math.random()*ps.length)];
		//console.log(py);
		//汉语声调标注规律顺序是aoeiu，其中如果是i、u并排谁在后标谁头上，如果iú或uí
		var cag='āáǎàa,ōóǒòo,ēéěèe,īíǐìi,ūúǔùu,ǖǘǚǜü';
		var cags=cag.split(',');
		let numi=0;
		cags.find((n)=>{
			let len=n.length-1;
			let a=n[len];
			if(py.indexOf('iu')>=0){//i、u并排靠后标
				numi=py.indexOf('i');
				py=py.replace('i','');
			}
			let jqxs=['jü','qü','xü'];
			jqxs.forEach((a)=>{
				if(py.indexOf(a)>=0){
					py=py.replace('ü','u');
				}
			})
			if(py.indexOf(a)>=0){
				let num=type<=0?Math.ceil(Math.random()*4):type;
				if(num<=4){
					py=py.replace(a,n[num-1]);
				}else{
					py=py;
				}
				if(numi>0){
					py=py.split('');
					py.splice(numi,0,'i');
					py=py.join('');
				}
				return true;
			}
		})
		return py;
	}
	function name(type=1){
		let fname=P1_firstNames[Math.floor(Math.random()*P1_firstNames.length)];
		let lname=P1_lastNames[Math.floor(Math.random()*P1_lastNames.length)];
		switch(type){
			case 1:return fname+''+lname;
			case 2:return fname;
			case 3:return lname;
		}
		return fname+''+lname;
	}
	/**数组随机排序*/
	function arrayRandomSort(arr){
		arr.sort(()=>{return 0.5-Math.random()});
	}
	/**删除数组中相同的值*/
	function arrayRemoveSame(array){
		return [...new Set(array)];
	}
	/**得到数组里的随机值*/
	function getArrayRandomValue(array,num=1){
		if(num==1){
			return array[Math.floor(Math.random()*array.length)];
		}else{
			let arr=[];
			num=num<array.length?num:array.length;
			while(arr.length<num){
				let n=array[Math.floor(Math.random()*array.length)];
				if(!arr.includes(n))arr.push(n);
			}
			return arr;
		}
	}
	exports.color = color;//颜色
	exports.number = number;//数字
	exports.randomSeed = randomSeed;//种子
	exports.numberBySeed = numberBySeed;//种子随机数
	exports.letter = letter;//字母
	exports.key = key;//激活码
	exports.hanzi = hanzi;//汉字
	exports.sign = sign;//符号
	exports.morse = morse;//摩斯码
	exports.calc = calc;//计算题
	exports.calcResult = calcResult;//计算题答案
	exports.pinyin = pinyin;//拼音
	exports.name = name;//名字
	exports.arrayRandomSort = arrayRandomSort;
	exports.arrayRemoveSame = arrayRemoveSame;
	exports.getArrayRandomValue = getArrayRandomValue;
    Object.defineProperty(exports, "__esModule", {
        value: true
    });
    return exports
}
({});
const P1_PY=[
	["b","p","m","f","d","t","n","l","g","k","h","j","q","x","z","c","s","zh","ch","sh","r","y","w"],
	["ba","pa","ma","fa","da","ta","na","la","ga","ka","ha",,,,"za","ca","sa","zha","cha","sha",,"ya","wa"],
	["bai","pai","mai",,"dai","tai","nai","lai","gai","kai","hai",,,,"zai","cai","sai","zhai","chai","shai",,,"wai"],
	["ban","pan","man","fan","dan","tan","nan","lan","gan","kan","han",,,,"zan","can","san","zhan","chan","shan","ran","yan","wan"],
	["bang","pang","mang","fang","dang","tang","nang","lang","gang","kang","hang",,,,"zang","cang","sang","zhang","chang","shang","rang","yang","wang"],
	["bao","pao","mao",,"dao","tao","nao","lao","gao","kao","hao",,,,"zao","cao","sao","zhao","chao","shao","rao","yao",],
	["bo","po","mo","fo",,,,,,,,,,,,,,,,,,"yo","wo"],
	[,,,,"dong","tong","nong","long","gong","kong","hong",,,,"zong","cong","song","zhong","chong",,"rong","yong",],
	[,"pou","mou","fou","dou","tou","nou","lou","gou","kou","hou",,,,"zou","cou","sou","zhou","chou","shou","rou","you",],
	[,,"me",,"de","te","ne","le","ge","ke","he",,,,"ze","ce","se","zhe","che","she","re","ye",],
	["bei","pei","mei","fei","dei",,"nei","lei","gei","kei","hei",,,,"zei",,,,,"shei",,,"wei"],
	["ben","pen","men","fen","den",,"nen",,"gen","ken","hen",,,,"zen","cen","sen","zhen","chen","shen","ren",,"wen"],
	["beng","peng","meng","feng","deng","teng","neng","leng","geng","keng","heng",,,,"zeng","ceng","seng","zheng","cheng","sheng","reng",,"weng"],
	[,,,,,,,,,,,,,,,,,,,,,,],
	["bi","pi","mi",,"di","ti","ni","li",,,,"ji","qi","xi","zi","ci","si","zhi","chi","shi","ri","yi",],
	[,,,,"dia",,,"lia",,,,"jia","qia","xia",,,,,,,,,],
	["biao","piao","miao",,"diao","tiao","niao","liao",,,,"jiao","qiao","xiao",,,,,,,,,],
	["bian","pian","mian",,"dian","tian","nian","lian",,,,"jian","qian","xian",,,,,,,,,],
	[,,,,,,"niang","liang",,,,"jiang","qiang","xiang",,,,,,,,,],
	["bie","pie","mie",,"die","tie","nie","lie",,,,"jie","qie","xie",,,,,,,,,],
	["bin","pin","min",,,,"nin","lin",,,,"jin","qin","xin",,,,,,,,"yin",],
	["bing","ping","ming",,"ding","ting","ning","ling",,,,"jing","qing","xing",,,,,,,,"ying",],
	[,,,,,,,,,,,"jiong","qiong","xiong",,,,,,,,,],
	["bu","pu","miu",,"diu",,"niu","liu",,,,"jiu","qiu","xiu",,,,,,,,,],
	[,,"mu","fu","du","tu","nu","lu","gu","ku","hu",,,,"zu","cu","su","zhu","chu","shu","ru","yu","wu"],
	[,,,,,,,,"gua","kua","hua",,,,,,,"zhua","chua","shua",,"yue",],
	[,,,,,,,,"guai","kuai","huai",,,,,,,"zhuai","chuai","shuai",,,],
	[,,,,"duan","tuan","nuan","luan","guan","kuan","huan",,,,"zuan","cuan","suan","zhuan","chuan","shuan","ruan","yuan",],
	[,,,,,,,,"guang","kuang","huang",,,,,,,"zhuang","chuang","shuang",,,],
	[,,,,"dui","tui",,,"gui","kui","hui",,,,"zui","cui","sui","zhui","chui","shui","rui",,],
	[,,,,"dun","tun",,"lun","gun","kun","hun",,,,"zun","cun","sun","zhun","chun","shun","run","yun",],
	[,,,,"duo","tuo","nuo","luo","guo","kuo","huo",,,,"zuo","cuo","suo","zhuo","chuo","shuo","ruo",,],
	[,,,,,,"nü","lü",,,,"jü","qü","xü",,,,,,,,,],
	[,,,,,,,,,,,"jüan","qüan","xüan",,,,,,,,,],
	[,,,,,,"nüe","lüe",,,,"jüe","qüe","xüe",,,,,,,,,],
	[,,,,,,,,,,,"jün","qün","xün",,,,,,,,,],
]
const P1_firstNames = new Array(
	'赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '楮', '卫', '蒋', '沈', '韩', '杨',
	'朱', '秦', '尤', '许', '何', '吕', '施', '张', '孔', '曹', '严', '华', '金', '魏', '陶', '姜',
	'戚', '谢', '邹', '喻', '柏', '水', '窦', '章', '云', '苏', '潘', '葛', '奚', '范', '彭', '郎',
	'鲁', '韦', '昌', '马', '苗', '凤', '花', '方', '俞', '任', '袁', '柳', '酆', '鲍', '史', '唐',
	'费', '廉', '岑', '薛', '雷', '贺', '倪', '汤', '滕', '殷', '罗', '毕', '郝', '邬', '安', '常',
	'乐', '于', '时', '傅', '皮', '卞', '齐', '康', '伍', '余', '元', '卜', '顾', '孟', '平', '黄',
	'和', '穆', '萧', '尹', '姚', '邵', '湛', '汪', '祁', '毛', '禹', '狄', '米', '贝', '明', '臧',
	'计', '伏', '成', '戴', '谈', '宋', '茅', '庞', '熊', '纪', '舒', '屈', '项', '祝', '董', '梁',
	'杜', '阮', '蓝', '闽', '席', '季', '麻', '强', '贾', '路', '娄', '危', '江', '童', '颜', '郭',
	'梅', '盛', '林', '刁', '锺', '徐', '丘', '骆', '高', '夏', '蔡', '田', '樊', '胡', '凌', '霍',
	'虞', '万', '支', '柯', '昝', '管', '卢', '莫', '经', '房', '裘', '缪', '干', '解', '应', '宗',
	'丁', '宣', '贲', '邓', '郁', '单', '杭', '洪', '包', '诸', '左', '石', '崔', '吉', '钮', '龚',
	'程', '嵇', '邢', '滑', '裴', '陆', '荣', '翁', '荀', '羊', '於', '惠', '甄', '麹', '家', '封',
	'芮', '羿', '储', '靳', '汲', '邴', '糜', '松', '井', '段', '富', '巫', '乌', '焦', '巴', '弓',
	'牧', '隗', '山', '谷', '车', '侯', '宓', '蓬', '全', '郗', '班', '仰', '秋', '仲', '伊', '宫',
	'宁', '仇', '栾', '暴', '甘', '斜', '厉', '戎', '祖', '武', '符', '刘', '景', '詹', '束', '龙',
	'叶', '幸', '司', '韶', '郜', '黎', '蓟', '薄', '印', '宿', '白', '怀', '蒲', '邰', '从', '鄂',
	'索', '咸', '籍', '赖', '卓', '蔺', '屠', '蒙', '池', '乔', '阴', '郁', '胥', '能', '苍', '双',
	'闻', '莘', '党', '翟', '谭', '贡', '劳', '逄', '姬', '申', '扶', '堵', '冉', '宰', '郦', '雍',
	'郤', '璩', '桑', '桂', '濮', '牛', '寿', '通', '边', '扈', '燕', '冀', '郏', '浦', '尚', '农',
	'温', '别', '庄', '晏', '柴', '瞿', '阎', '充', '慕', '连', '茹', '习', '宦', '艾', '鱼', '容',
	'向', '古', '易', '慎', '戈', '廖', '庾', '终', '暨', '居', '衡', '步', '都', '耿', '满', '弘',
	'匡', '国', '文', '寇', '广', '禄', '阙', '东', '欧', '殳', '沃', '利', '蔚', '越', '夔', '隆',
	'师', '巩', '厍', '聂', '晁', '勾', '敖', '融', '冷', '訾', '辛', '阚', '那', '简', '饶', '空',
	'曾', '毋', '沙', '乜', '养', '鞠', '须', '丰', '巢', '关', '蒯', '相', '查', '后', '荆', '红',
	'游', '竺', '权', '逑', '盖', '益', '桓', '公', '仉', '督', '晋', '楚', '阎', '法', '汝', '鄢',
	'涂', '钦', '岳', '帅', '缑', '亢', '况', '后', '有', '琴', '归', '海', '墨', '哈', '谯', '笪',
	'年', '爱', '阳', '佟', '商', '牟', '佘', '佴', '伯', '赏', '万俟', '司马', '上官', '欧阳', '夏侯',
	'诸葛', '闻人', '东方', '赫连', '皇甫', '尉迟', '公羊', '澹台', '公冶', '宗政', '濮阳', '淳于',
	'单于', '太叔', '申屠', '公孙', '仲孙', '轩辕', '令狐', '锺离', '宇文', '长孙', '慕容', '鲜于',
	'闾丘', '司徒', '司空', '丌官', '司寇', '子车', '微生', '颛孙', '端木', '巫马', '公西', '漆雕',
	'乐正', '壤驷', '公良', '拓拔', '夹谷', '宰父', '谷梁', '段干', '百里', '东郭', '南门', '呼延',
	'羊舌', '梁丘', '左丘', '东门', '西门', '南宫'
)

const P1_lastNames = new Array(
	'子璇', '淼', '国栋', '夫子', '瑞堂', '甜', '敏', '尚', '国贤', '贺祥', '晨涛',
	'昊轩', '易轩', '益辰', '益帆', '益冉', '瑾春', '瑾昆', '春齐', '杨', '文昊',
	'东东', '雄霖', '浩晨', '熙涵', '溶溶', '冰枫', '欣欣', '宜豪', '欣慧', '建政',
	'美欣', '淑慧', '文轩', '文杰', '欣源', '忠林', '榕润', '欣汝', '慧嘉', '新建',
	'建林', '亦菲', '林', '冰洁', '佳欣', '涵涵', '禹辰', '淳美', '泽惠', '伟洋',
	'涵越', '润丽', '翔', '淑华', '晶莹', '凌晶', '苒溪', '雨涵', '嘉怡', '佳毅',
	'子辰', '佳琪', '紫轩', '瑞辰', '昕蕊', '萌', '明远', '欣宜', '泽远', '欣怡',
	'佳怡', '佳惠', '晨茜', '晨璐', '运昊', '汝鑫', '淑君', '晶滢', '润莎', '榕汕',
	'佳钰', '佳玉', '晓庆', '一鸣', '语晨', '添池', '添昊', '雨泽', '雅晗', '雅涵',
	'清妍', '诗悦', '嘉乐', '晨涵', '天赫', '玥傲', '佳昊', '天昊', '萌萌', '若萌',
	'秋白', '南风', '醉山', '初彤', '凝海', '紫文', '凌晴', '香卉', '雅琴', '傲安',
	'傲之', '初蝶', '寻桃', '代芹', '诗霜', '春柏', '绿夏', '碧灵', '诗柳', '夏柳',
	'采白', '慕梅', '乐安', '冬菱', '紫安', '宛凝', '雨雪', '易真', '安荷', '静竹',
	'飞雪', '雪兰', '雅霜', '从蓉', '冷雪', '靖巧', '翠丝', '觅翠', '凡白', '乐蓉',
	'迎波', '丹烟', '梦旋', '书双', '念桃', '夜天', '海桃', '青香', '恨风', '安筠',
	'觅柔', '初南', '秋蝶', '千易', '安露', '诗蕊', '山雁', '友菱', '香露', '晓兰',
	'涵瑶', '秋柔', '思菱', '醉柳', '以寒', '迎夏', '向雪', '香莲', '以丹', '依凝',
	'如柏', '雁菱', '凝竹', '宛白', '初柔', '南蕾', '书萱', '梦槐', '香芹', '南琴',
	'绿海', '沛儿', '晓瑶', '听春', '易巧', '念云', '晓灵', '静枫', '夏蓉', '如南',
	'幼丝', '秋白', '冰安', '凝蝶', '紫雪', '念双', '念真', '曼寒', '凡霜', '白卉',
	'语山', '冷珍', '秋翠', '夏柳', '如之', '忆南', '书易', '翠桃', '寄瑶', '如曼',
	'问柳', '香梅', '幻桃', '又菡', '春绿', '醉蝶', '亦绿', '诗珊', '听芹', '新之',
	'博瀚', '博超', '才哲', '才俊', '成和', '成弘', '昊苍', '昊昊', '昊空', '昊乾',
	'昊然', '昊然', '昊天', '昊焱', '昊英', '浩波', '浩博', '浩初', '浩大', '浩宕',
	'浩荡', '浩歌', '浩广', '浩涆', '浩瀚', '浩浩', '浩慨', '浩旷', '浩阔', '浩漫',
	'浩淼', '浩渺', '浩邈', '浩气', '浩然', '浩穰', '浩壤', '浩思', '浩言', '皓轩',
	'和蔼', '和安', '和昶', '翔东', '昊伟', '楚桥', '智霖', '浩杰', '炎承', '思哲',
	'璟新', '楚怀', '继智', '昭旺', '俊泽', '子中', '羽睿', '嘉雷', '鸿翔', '明轩',
	'棋齐', '轶乐', '昭易', '臻翔', '泽鑫', '芮军', '浩奕', '宏明', '忠贤', '锦辉',
	'元毅', '霈胜', '宇峻', '子博', '语霖', '胜佑', '俊涛', '浩淇', '乐航', '泽楷',
	'嘉宁', '敬宣', '韦宁', '建新', '宇怀', '皓玄', '冠捷', '俊铭', '一鸣', '堂耀',
	'轩凝', '舰曦', '跃鑫', '梓杰', '筱宇', '弘涛', '羿天', '广嘉', '陆铭', '志卿',
	'连彬', '景智', '孟昕', '羿然', '文渊', '羿楦', '晗昱', '晗日', '涵畅', '涵涤',
	'昊穹', '涵亮', '涵忍', '涵容', '俊可', '智鹏', '诚钰', '书墨', '俊易', '浩渺',
	'宸水', '嘉许', '时贤', '飞腾', '沂晨', '殿斌', '霄鸿', '辰略', '澜鸿', '景博',
	'咨涵', '修德', '景辉', '语旋', '智逸', '鸿锋', '思梵', '弈煊', '泰河', '逞宇',
	'嘉颢', '锦沅', '颢焱', '萧彬', '悦升', '香音', '烨柠', '颢咏', '仁贤', '尚然',
	'羿鳞', '月鸿', '健霖', '鸿昊', '竣杰', '可顺', '炯乐', '俊彦', '海沧', '捷明',
	'飞扬', '杰辰', '羽捷', '曦晴', '裕鸿', '翌锦', '沐宸', '福同', '旻驰', '龙宁',
	'文虹', '义凡', '广晨', '宸滔', '嘉岐', '雅珺', '睿明', '皓轩', '程天', '子酝',
	'艾康', '如羽', '冠玉', '子歉', '永昊', '龙华', '兆颜', '奇文', '月昕', '裕锦',
	'昂佳', '昊浩', '宇韬', '睿焓', '永译', '鸿彬', '颢霖', '益彬', '虹昊', '飞悦',
	'睿珏', '?宵童', '睿鸿', '容冰', '逸濠', '楷岩', '弘义', '海萦', '昊孺', '梓铭',
	'生钊', '蓝玺', '晨辕', '宇菡', '砚海', '文揩', '韬瑞', '彦红', '奕韦', '清予',
	'宁翼', '冬睿', '锦昌', '烨宁', '昌权', '国研', '德运', '孝清', '佳阳', '凯玮',
	'正真', '民云', '昕冶', '力威', '帅欣', '知淳', '烨飞', '兴远', '子墨', '澄欣',
	'烨煊', '悦勤', '晨津', '博宏', '育萌', '羽炫', '绍钧', '睿昌', '泓千', '颢炜',
	'虹金', '筠航', '元甲', '星明', '景涛', '铭虹', '德本', '向辉', '基翔', '家易',
	'欣鹏', '羽荃', '泽容', '弘亮', '尚廷', '轩梓', '甫津', '彬楷', '寅飞', '愉君',
	'阳平', '誉杰', '钦昭', '蕴藉', '羽程', '宏海', '涵畅', '光浩', '令沂', '浩浩',
	'睿锦', '易泽', '俊康', '家文', '晨元', '语洋', '裕宏', '梓榛', '阳嘉', '恒展',
	'雨远', '哲伊', '逸江', '丰源', '学东', '奇岩', '浩财', '和蔼', '红言', '瑞赫',
	'森圆', '欣赢', '梓鸿', '博明', '铭育', '颢硕', '宇烯', '宇如', '淳炎', '源承',
	'斌彬', '飞沉', '鸿璐', '昊弘'
)